package com.jwthhealth_pub.old.sportfitness.view.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.old.sportfitness.view.SportCourseListActivity;

import java.util.List;

/**
 * Created by Administrator on 2017/1/6.
 */
public class SportItemFootVerAdapter extends RecyclerView.Adapter {

    private List<String> list;
    private Context activit;

    public SportItemFootVerAdapter(SportCourseListActivity sportCourseListActivity, List<String> sport_desc) {
        this.list = sport_desc;
        this.activit = sportCourseListActivity;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(activit, R.layout.item_text, null);
        return new ViewHolder(view);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ViewHolder viewHolder = (ViewHolder) holder;
        viewHolder.text.setText(list.get(position));
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    class ViewHolder extends RecyclerView.ViewHolder{

        TextView text;

        public ViewHolder(View itemView) {
            super(itemView);
            text = (TextView) itemView.findViewById(R.id.text);
        }
    }
}
